package com.hsc.yalebao.adapter;

import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.ColorMatrix;
import android.graphics.ColorMatrixColorFilter;
import android.util.DisplayMetrics;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.hsc.yalebao.base.CustomApplication;
import com.hsc.yalebao.model.RoomListBaseBean;
import com.hsc.yalebao.tabIndex.RoomListActivity;
import com.hsc.yalebao.weight.LogUtils;
import java.util.ArrayList;

@SuppressLint({"NewApi"})
public class RoomListAdapter extends BaseAdapter
{
  private Context context;
  private LayoutInflater inflater;
  public View.OnTouchListener onTouchListener = new View.OnTouchListener()
  {
    public boolean onTouch(View paramAnonymousView, MotionEvent paramAnonymousMotionEvent)
    {
      switch (paramAnonymousMotionEvent.getAction())
      {
      case 2:
      default:
      case 1:
      case 0:
      case 3:
      }
      while (true)
      {
        return true;
        RoomListAdapter.this.changeLight((ImageView)paramAnonymousView, 0);
        if ((RoomListAdapter.this.context instanceof RoomListActivity))
        {
          RoomListBaseBean localRoomListBaseBean = (RoomListBaseBean)((ImageView)paramAnonymousView).getTag();
          ((RoomListActivity)RoomListAdapter.this.context).imageAction(localRoomListBaseBean);
          continue;
          RoomListAdapter.this.changeLight((ImageView)paramAnonymousView, -80);
          continue;
          RoomListAdapter.this.changeLight((ImageView)paramAnonymousView, 0);
        }
      }
    }
  };
  public ArrayList<RoomListBaseBean> result;
  private int screenWidth;
  private String type = "home";

  public RoomListAdapter(Context paramContext, ArrayList<RoomListBaseBean> paramArrayList, String paramString)
  {
    this.context = paramContext;
    this.inflater = LayoutInflater.from(paramContext);
    this.result = paramArrayList;
    this.type = paramString;
    this.screenWidth = CustomApplication.app.displayMetrics.widthPixels;
  }

  private void changeLight(ImageView paramImageView, int paramInt)
  {
    ColorMatrix localColorMatrix = new ColorMatrix();
    float[] arrayOfFloat = new float[20];
    arrayOfFloat[0] = 1.0F;
    arrayOfFloat[1] = 0.0F;
    arrayOfFloat[2] = 0.0F;
    arrayOfFloat[3] = 0.0F;
    arrayOfFloat[4] = paramInt;
    arrayOfFloat[5] = 0.0F;
    arrayOfFloat[6] = 1.0F;
    arrayOfFloat[7] = 0.0F;
    arrayOfFloat[8] = 0.0F;
    arrayOfFloat[9] = paramInt;
    arrayOfFloat[10] = 0.0F;
    arrayOfFloat[11] = 0.0F;
    arrayOfFloat[12] = 1.0F;
    arrayOfFloat[13] = 0.0F;
    arrayOfFloat[14] = paramInt;
    arrayOfFloat[15] = 0.0F;
    arrayOfFloat[16] = 0.0F;
    arrayOfFloat[17] = 0.0F;
    arrayOfFloat[18] = 1.0F;
    arrayOfFloat[19] = 0.0F;
    localColorMatrix.set(arrayOfFloat);
    paramImageView.setColorFilter(new ColorMatrixColorFilter(localColorMatrix));
  }

  public int getCount()
  {
    if (this.result == null)
      return 0;
    return this.result.size();
  }

  public Object getItem(int paramInt)
  {
    return this.result.get(paramInt);
  }

  public long getItemId(int paramInt)
  {
    return paramInt;
  }

  public View getView(int paramInt, View paramView, ViewGroup paramViewGroup)
  {
    ViewHolder localViewHolder;
    if (paramView == null)
    {
      localViewHolder = new ViewHolder();
      paramView = this.inflater.inflate(2130903148, null);
      localViewHolder.rel_pic = ((RelativeLayout)paramView.findViewById(2131100158));
      localViewHolder.iv_pic = ((ImageView)paramView.findViewById(2131100146));
      localViewHolder.tv_person_count = ((TextView)paramView.findViewById(2131100159));
      localViewHolder.tv_name = ((TextView)paramView.findViewById(2131100160));
      paramView.setTag(localViewHolder);
    }
    RoomListBaseBean localRoomListBaseBean;
    while (true)
    {
      localRoomListBaseBean = (RoomListBaseBean)this.result.get(paramInt);
      if (localRoomListBaseBean != null)
        break;
      return paramView;
      localViewHolder = (ViewHolder)paramView.getTag();
    }
    Bitmap localBitmap = BitmapFactory.decodeResource(this.context.getResources(), 2130837822);
    int i = localBitmap.getWidth();
    int j = localBitmap.getHeight();
    DisplayMetrics localDisplayMetrics = this.context.getResources().getDisplayMetrics();
    (j * (localDisplayMetrics.widthPixels / 2) / i);
    int k = localDisplayMetrics.heightPixels / 3;
    int m = k * i / j;
    ViewGroup.LayoutParams localLayoutParams1 = localViewHolder.iv_pic.getLayoutParams();
    localLayoutParams1.width = m;
    localLayoutParams1.height = k;
    localViewHolder.iv_pic.setLayoutParams(localLayoutParams1);
    ViewGroup.LayoutParams localLayoutParams2 = localViewHolder.tv_name.getLayoutParams();
    localLayoutParams2.height = (k / 6);
    localViewHolder.tv_name.setLayoutParams(localLayoutParams2);
    String str1 = localRoomListBaseBean.getTitle();
    int n = localRoomListBaseBean.getOnline_num();
    LogUtils.d("", "title:" + str1);
    String str2 = "";
    switch (paramInt)
    {
    default:
    case 0:
    case 1:
    case 2:
    case 3:
    }
    while (true)
    {
      localViewHolder.tv_name.setText(str1);
      localViewHolder.tv_person_count.setText("在线 " + n + " 人");
      int i1 = this.context.getResources().getIdentifier(str2, "drawable", this.context.getPackageName());
      LogUtils.d("", "resource:" + i1);
      localViewHolder.iv_pic.setImageResource(i1);
      localViewHolder.iv_pic.setOnTouchListener(this.onTouchListener);
      localViewHolder.iv_pic.setTag(localRoomListBaseBean);
      return paramView;
      str2 = "img_fjlb_tu1";
      continue;
      str2 = "img_fjlb_tu2";
      continue;
      str2 = "img_fjlb_tu3";
      continue;
      str2 = "img_fjlb_tu4";
    }
  }

  public void setData(ArrayList<RoomListBaseBean> paramArrayList)
  {
    this.result = paramArrayList;
  }

  public class ViewHolder
  {
    public ImageView iv_pic;
    public RelativeLayout rel_pic;
    public TextView tv_name;
    public TextView tv_person_count;

    public ViewHolder()
    {
    }
  }
}

/* Location:           C:\Users\user\Desktop\dd28_pcdd720\classes_dex2jar.jar
 * Qualified Name:     com.hsc.yalebao.adapter.RoomListAdapter
 * JD-Core Version:    0.6.2
 */